package com.mall.pay.dto;

import com.mall.commons.result.AbstractRequest;
import com.mall.commons.tool.exception.ValidateException;
import com.mall.pay.constant.PayRetCode;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * @author xudengfeng
 * @date 2020/12/22 19:53
 */
@Data
public class PayRequest extends AbstractRequest {

    private static final long serialVersionUID = 7880342881884504538L;
    Map map;

    @Override
    public void requestCheck() {
        String orderId = (String) map.get("orderId");
        String money = (String) map.get("money");
        if (StringUtils.isBlank(orderId)) {
            throw new ValidateException(PayRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(), PayRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
        if (StringUtils.isBlank(money)) {
            throw new ValidateException(PayRetCode.REQUISITE_PARAMETER_NOT_EXIST.getCode(), PayRetCode.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
    }
}
